L=10000; S=9; T=10; M=100; stones=[8888,8869,8872,2548,8875,8887,8881,8877,8876,6410,8883,7480,5887,5221,2416,5665,8878,1343,1718,8884,8910,8908,8776,8907,8905,8903,8899,8902,577,9347,9387,8906,4685,8893,8891,9849,5767,8892,2071,8890,1502,1483,1500,1492,1496,1501,1489,5917,1486,1498,9364,5195,8715,1497,5639,5699,3602,1618,9208,9780,1490,1479,1480,1472,1484,2872,1475,1473,7318,565,6137,555,9377,8026,1482,1487,8695,1476,7813,6271,6260,6261,6259,6241,6253,6248,6244,6254,936,6258,6250,6245,4746,2531,6017,6255,6686,508,5697,9613];